package com.zsj.queue;

import java.io.Serializable;
import java.util.Iterator;
import java.util.Spliterator;
import java.util.function.Consumer;

/**
 * @Author zsj
 * @Version 1.0
 * @Date 2024/3/25 17:04
 * @Description 双向环形链表实现双端队列
 */
public class LinkedListDeque<E> implements
        Deque<E>,
        Iterable<E>,
        Serializable {

    //链表内部类
    private class Node<E> {
        private Node<E> prev;
        private Node<E> next;
        E value;

        public Node(E value, Node<E> prev, Node<E> next) {
            this.prev = prev;
            this.next = next;
            this.value = value;
        }
    }

    @Override
    public boolean offerFirst(E value) {
        return false;
    }

    @Override
    public boolean offerEnd(E value) {
        return false;
    }

    @Override
    public E poolFirst() {
        return null;
    }

    @Override
    public E pollLast() {
        return null;
    }

    @Override
    public E peekFirst() {
        return null;
    }

    @Override
    public E peekLast() {
        return null;
    }

    @Override
    public boolean isEmpty() {
        return false;
    }

    @Override
    public boolean isFull() {
        return false;
    }

    @Override
    public Iterator<E> iterator() {
        return new Iterator<E>() {
            @Override
            public boolean hasNext() {
                return false;
            }

            @Override
            public E next() {
                return null;
            }
        };
    }

    @Override
    public void forEach(Consumer<? super E> action) {
        Iterable.super.forEach(action);
    }

    @Override
    public Spliterator<E> spliterator() {
        return Iterable.super.spliterator();
    }
}
